In [1]:
require 'daru/view'
Out[1]:
In [2]:
Daru::View.plotting_library = :googlecharts
Out[2]:
In [8]:
data = [
['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
['2004/05', 165, 938, 522, 998, 450, 614.6],
['2005/06', 135, 1120, 599, 1268, 288, 682],
['2006/07', 157, 1167, 587, 807, 397, 623],
['2007/08', 139, 1110, 615, 968, 215, 609.4],
['2008/09', 136, 691, 629, 1026, 366, 569.6]
]
combo_chart_table = Daru::View::Table.new(data)
combo_chart_table.show_in_iruby
Out[8]:
In [7]:
combo_chart_options = {
title: 'Monthly Coffee Production by Country',
vAxis: {title: 'Cups'},
hAxis: {title: 'Month'},
seriesType: 'bars',
series: {5 => {type: 'line'}}, # can' do like that 5: {type: 'line'}
type: :combo, height: 400
}
combo_chart_chart = Daru::View::Plot.new(combo_chart_table.table, combo_chart_options)
combo_chart_chart.show_in_iruby
Out[7]:
All other options present here : https://developers.google.com/chart/interactive/docs/gallery/combochart#overview
In [ ]: